1. Field of the Invention
The present invention relates to a technology for performing an interrupt processing of an embedded software and a synchronized exclusive control using the interrupt processing.
2. Description of the Related Art
In general, the embedded software secures a real-time operation using an interrupt processing to make a prompt response to a change of an external condition. Furthermore, the embedded software employs a real-time operating system (OS) for an embedded control, such as μITRON, to realize a synchronized exclusive control of a semaphore, an event flag, a mail box, etc.
One of the conventional technologies for realizing the synchronized exclusive control is disclosed in Japanese Patent Application Laid-open Publication No. H7-295840. In this technology, the synchronized exclusive control is realized by setting up an execution condition to a task and controlling an order of execution, so that a memory area and a programming step caused by using an OS of a multiprogramming system that is adapted to an embedded system are deleted. As a result, an efficiency of resources is increased, and a productivity and a maintainability are enhanced.
An event-establishment-condition storing unit stores a type of condition for executing a task, which is set for every vectors obtained by segmentalizing a program, (such as event waiting, message waiting, time waiting, wake-up waiting), and a condition for establishing a state (such as event waiting, and event established). A condition storing unit stores a condition for releasing the event waiting corresponding to a time when an event that is stored in the event-establishment-condition storing unit is established. A task block stores control information for controlling the task.
A task-included event managing unit compares an event establishment condition stored in the event-establishment-condition storing unit with an occurred event. A task-included event-waiting managing unit transits a task that has been in a state of event waiting by a detecting function of the task-included event managing unit based on the control information stored in the task block into an event-waiting state, and stores the task that is transited into the event-waiting state in an event-waiting task storing unit. Then, at a time when an event-waiting releasing condition is established for the task in the event-waiting state, the task-included event-waiting managing unit transits the task into an execution-waiting state, and stores the task that is transited into the execution-waiting state in an execution-waiting task storing unit. A task managing unit selects one task from among a task that is under an execution by a current central processing unit (CPU), which is stored in an under-execution task storing unit, and an execution-waiting task that is stored in the execution-waiting task storing unit, and transits the selected task into an execution state.
In the conventional technology described above, the synchronized exclusive control is realized by setting up an execution condition to a task and controlling an order of execution of the task, when using an OS (a real-time OS) of the multiprogramming system.
However, a memory capacity of a product in which the embedded software is built is limited. Therefore, when a real-time OS is used to realize the synchronized exclusive control, as described in the conventional technology, a memory capacity that can be used for a program actually needed becomes small. This problem becomes more critical in a product in which a processor that executes the embedded software, a read only memory (ROM) that stores the embedded software, and a random access memory (RAM) that temporarily stores data necessary for executing the embedded software are implemented in one chip
In addition, in the real-time OS, the synchronized exclusive control of the semaphore and the like can be realized by setting up a waiting state to a task. However, when tasks of different priorities share the semaphore, it may cause the priority to be reversed.
When a task of a low priority is taking the semaphore, a task of a high priority becomes in a waiting state. If a task of a mid priority occurs at this moment, which has a priority higher than the low priority and lower than the high priority, the task of the mid priority is executed prior to the task taking the semaphore. Then, the task of the high priority is finally executed after execution of the task taking the semaphore. In other words, the tasks are processed in a different order from the predetermined priority.
One of the possible methods to cope with the above problems can be developing an embedded software with only the interrupt processing, without using the real-time OS. However, if the embedded software is developed with only the interrupt processing without using the real-time OS, it is not possible to carry out the synchronized exclusive control. In addition, although it is possible to recognize an occurrence of the interrupt processing, it is not possible to recognize how many times the interrupt processing has occurred. Furthermore, when an interrupt occurs, the state must be held in a stack area, which causes the interrupt to be in a forbidden state during the time of holding the state in the stack area. As a result, the real-time property becomes deteriorated.